/**
 * Created by yangchen on 2019/4/4
 * */

/**
 * 深圳 河北 公共模块
 */
export default class SH {
  /**
   * hack年报填写数据 年报字段有变化
   * @param inputData 本年数据
   * @param lastYearData 上年数据
   * @param sheet 报表类型
   * @returns {{}}
   */
  static hackYearReportInput(inputData, lastYearData, sheet) {
    let keys = Object.keys(lastYearData);
    let results = keys.reduce((result, key) => {
      if (sheet === 'profit') {
        result[key.replace('G', 'J')] = lastYearData[key];
      } else if (sheet === 'cash') {
        // 特殊处理
        if (key.includes('E')) {
          result[key] = inputData[key.replace('E', 'F')];
        }
        if (key.includes('F')) {
          result[key] = lastYearData[key];
        }
      }
      return result;
    }, {});
    return { ...inputData, ...results };
  }
}
